#!/bin/bash
# Name of nodes to start, here we have a single node
export HOSTID=

#必须保证hostname传递给celery是字符串的，如果hostname为数字，则会引起循环启动n个worker
CELERYD_NODES=\"`hostname`\"

if [ -z $CELERYD_NODES ];then
    echo "error !node name can not be null,check [CELERY_NODES] in /opt/tcloud/conf.d/cnode.run"
    exit 1
fi

CELERYD_QUEUES="all,$CELERYD_NODES"

# Where to chdir at start.
CELERYD_CHDIR="/opt/tcloud/cvirt"

# How to call "manage.py celeryd_multi"
CELERYD_MULTI="python $CELERYD_CHDIR/manage.pyc celeryd_multi"

# How to call "manage.py celeryctl"
CELERYCTL="python $CELERYD_CHDIR/manage.pyc celeryctl"

# Extra arguments to celeryd

CELERYD_OPTS="-Q $CELERYD_QUEUES -n $CELERYD_NODES --time-limit=300 --concurrency=150 -P eventlet"

#日志文件名和pid文件名固定使用cnode，这样在主机被修改后不会重新生成文件
CELERYD_LOG_FILE="/var/log/cnode/cnode.log"
CELERYD_PID_FILE="/var/run/cnode/cnode.pid"

# Workers should run as an unprivileged user.
CELERYD_USER="root"
CELERYD_GROUP="root"

# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="cvirt.settings"

CELERY_CREATE_DIRS=1

CELERYD_LOG_LEVEL=debug